home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2c.lha / p4-1.2c / Makefile < prev    next >
Makefile  |  1993-05-24  |  5KB  |  183 lines

  1. # top level makefile for p4
  2.  
  3. SHELL=/bin/sh
  4.  
  5. MFLAGS = 
  6. #MFLAGS = -i    # for alliant fx/8
  7.   
  8. P4_DIRS = util lib alog usc include bin servers 
  9.  
  10. EXAMPLES_DIRS = contrib messages monitors
  11.  
  12. ALL_DIRS = $(P4_DIRS) $(EXAMPLES_DIRS) lib_f messages_f contrib_f doc usc/usctest
  13.  
  14. DIRS = $(ALL_DIRS)
  15.  
  16. RM = /bin/rm
  17.  
  18. all:
  19.     @echo making p4 on architecture=$(P4ARCH)
  20.     @make makefiles P4ARCH=$(P4ARCH)
  21.     @make $(MFLAGS) links P4ARCH=$(P4ARCH)
  22.     @for dir in $(DIRS) ;\
  23.       do \
  24.       echo " " ;\
  25.       echo making p4 in directory $$dir ;\
  26.       (cd $$dir; make $(MFLAGS) default) ;\
  27.       done 
  28.  
  29. p4:
  30.     @echo making p4 on architecture=$(P4ARCH)
  31.     @make makefiles P4ARCH=$(P4ARCH)
  32.     @make $(MFLAGS) links P4ARCH=$(P4ARCH)
  33.     @for dir in $(P4_DIRS) ;\
  34.       do \
  35.       echo " " ;\
  36.       echo making p4 in directory $$dir ;\
  37.       (cd $$dir; make $(MFLAGS) default) ;\
  38.       done 
  39.  
  40. makefiles:
  41.     @(cd util; make -f makefile.proto defs.MD P4ARCH=$(P4ARCH))
  42.     @echo "making Makefiles in " $(DIRS)
  43.     @for dir in $(DIRS) ;\
  44.       do \
  45.       cat util/defs.MD $$dir/makefile.proto > $$dir/Makefile ;\
  46.       done 
  47.  
  48. #  @echo "#define  P4_$_MACHINE_TYPE \"$(P4ARCH)\"" >> lib/p4_config.h
  49. config_hdr:
  50.     @echo "#define P4_COMPILED_TIME  \"`date`\"" > lib/p4_config.h
  51.     @echo "#define  P4_MACHINE_TYPE \"$(P4ARCH)\"" >> lib/p4_config.h
  52.     @echo "#ifndef  $(P4ARCH)" >> lib/p4_config.h
  53.     @echo "#define  $(P4ARCH)" >> lib/p4_config.h
  54.     @echo "#endif  "            >> lib/p4_config.h
  55.     @cat OPTIONS >> lib/p4_config.h
  56.  
  57. links:
  58.     @if [ -f lib/p4_config.h ] ;\
  59.     then\
  60.         true ;\
  61.     else\
  62.         make config_hdr P4ARCH=$(P4ARCH) ;\
  63.     fi
  64.     @if [ -f include/alog.h ] ;\
  65.     then\
  66.         true ;\
  67.     else\
  68.         (cd include ;\
  69.         ln -s ../alog/alog.h . ;\
  70.         ln -s ../alog/alog_evntdfs.h . ;\
  71.         cd ..) ;\
  72.     fi
  73.     @if [ -f include/usc.h ] ;\
  74.     then\
  75.         true ;\
  76.     else\
  77.         (cd include ;\
  78.         ln -s ../usc/usc.h . ;\
  79.         ln -s ../usc/usc_sys.h . ;\
  80.         cd ..) ;\
  81.     fi
  82.     @if [ -f include/p4.h ] ;\
  83.     then\
  84.         true ;\
  85.     else\
  86.         (cd include ;\
  87.         ln -s ../lib/p4.h . ;\
  88.         ln -s ../lib/p4_MD.h . ;\
  89.         ln -s ../lib/p4_config.h . ;\
  90.         ln -s ../lib/p4_defs.h . ;\
  91.         ln -s ../lib/p4_funcs.h . ;\
  92.         ln -s ../lib/p4_globals.h . ;\
  93.         ln -s ../lib/p4_macros.h . ;\
  94.         ln -s ../lib/p4_mon.h . ;\
  95.         ln -s ../lib/p4_patchlevel.h . ;\
  96.         ln -s ../lib/p4_sock_util.h . ;\
  97.         ln -s ../lib/p4_sr.h . ;\
  98.         ln -s ../lib/p4_sys.h . ;\
  99.         ln -s ../lib/p4_sys_funcs.h . ;\
  100.         cd ..) ;\
  101.     fi
  102.     @if [ -f messages_f/p4f.h ] ;\
  103.     then\
  104.         true ;\
  105.     else\
  106.         (cd messages_f; ln -s ../lib_f/p4f.h . ; cd ..) ;\
  107.     fi
  108.     @if [ -f contrib_f/p4f.h ] ;\
  109.     then\
  110.         true ;\
  111.     else\
  112.         (cd contrib_f; ln -s ../lib_f/p4f.h . ; cd ..) ;\
  113.     fi
  114.  
  115. clean:  
  116.     @for dir in $(DIRS) ;\
  117.       do \
  118.       echo cleaning $$dir ;\
  119.       (cd $$dir; make clean) ;\
  120.       done
  121.     $(RM) -f *~ *.o *.bak
  122.  
  123. dist:    realclean   
  124.  
  125. realclean:
  126.     $(RM) -f *~ *.o *.bak
  127.     @for dir in $(DIRS) ;\
  128.       do \
  129.       echo cleaning $$dir ;\
  130.       (cd $$dir; make realclean) ;\
  131.       done
  132.  
  133. Makefiles: makefiles
  134.  
  135. INSTALLDIR = ./$(P4ARCH)
  136. install:
  137.     @echo installing p4 in $(INSTALLDIR)
  138.     @if [ -d $(INSTALLDIR) ] ;\
  139.     then\
  140.         echo 'using existing directory $(INSTALLDIR)' ;\
  141.     else\
  142.         mkdir $(INSTALLDIR) ;\
  143.     fi
  144.     @cp Makefile $(INSTALLDIR)
  145.     @mkdir $(INSTALLDIR)/util
  146.     @cp util/* $(INSTALLDIR)/util
  147.     @mkdir $(INSTALLDIR)/include
  148.     @cp include/*.h $(INSTALLDIR)/include
  149.     @mkdir $(INSTALLDIR)/lib
  150.     @cp lib/libp4.a $(INSTALLDIR)/lib
  151.     @grep RANLIB util/defs.MD > $(INSTALLDIR)/lib/makeranlib
  152.     @echo "doran:" >> $(INSTALLDIR)/lib/makeranlib
  153.     @echo "    $$(RANLIB) libp4.a" >> $(INSTALLDIR)/lib/makeranlib
  154.     @(cd  $(INSTALLDIR)/lib; make -f makeranlib doran; $(RM) makeranlib)
  155.     @mkdir $(INSTALLDIR)/bin
  156.     @cp bin/* $(INSTALLDIR)/bin
  157.     @mkdir $(INSTALLDIR)/examples
  158.     @cp messages/sr_test.c messages/sr_user.h  \
  159.       messages/systest.c messages/makefile.proto \
  160.       messages/run_ipsc messages/run_ncube messages/run_delta \
  161.       messages/sr_test.pg messages/systest.pg $(INSTALLDIR)/examples
  162.     @sed -e "s@P4_HOME_DIR = ..@P4_HOME_DIR = $(INSTALLDIR)@" \
  163.       $(INSTALLDIR)/examples/makefile.proto >  $(INSTALLDIR)/temp
  164.     @mv $(INSTALLDIR)/temp  $(INSTALLDIR)/examples/makefile.proto
  165.     @make makefiles DIRS=$(INSTALLDIR)/examples
  166.     @(cd $(INSTALLDIR)/examples; make sr_test systest)
  167.     @mkdir $(INSTALLDIR)/lib_f
  168.     @cp lib_f/libp4_f.a lib_f/*.h $(INSTALLDIR)/lib_f
  169.     @grep RANLIB util/defs.MD > $(INSTALLDIR)/lib_f/makeranlib
  170.     @echo "doran:" >> $(INSTALLDIR)/lib_f/makeranlib
  171.     @echo "    $$(RANLIB) libp4_f.a" >> $(INSTALLDIR)/lib_f/makeranlib
  172.     @(cd  $(INSTALLDIR)/lib_f; make -f makeranlib doran; $(RM) makeranlib)
  173.     @mkdir $(INSTALLDIR)/examples_f
  174.     @cp messages_f/sr_test.f messages_f/p4f.h  \
  175.       messages_f/makefile.proto \
  176.       messages_f/sr_test.pg $(INSTALLDIR)/examples_f
  177.     @sed -e "s@P4_HOME_DIR = ..@P4_HOME_DIR = $(INSTALLDIR)@" \
  178.       $(INSTALLDIR)/examples_f/makefile.proto >  $(INSTALLDIR)/temp
  179.     @mv $(INSTALLDIR)/temp  $(INSTALLDIR)/examples_f/makefile.proto
  180.     @make makefiles DIRS=$(INSTALLDIR)/examples_f
  181.     @(cd $(INSTALLDIR)/examples_f; make sr_test)
  182.     @echo installed p4 in $(INSTALLDIR)
  183.